home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12376 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: newserv.agcs.com!news
  2. From: "George B. T. Greene" <greeneg@agcs.com>
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: Statistically Random Number algorithm
  5. Date: 19 Mar 1996 19:35:52 GMT
  6. Organization: AG Communication Systems, ITS
  7. Message-ID: <4in2ao$5ee@newserv.agcs.com>
  8. References: <314D0B67.3C16@psu.edu>
  9. NNTP-Posting-Host: greeneg.agcs.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.2N (Windows; I; 32bit)
  14.  
  15. Whew!
  16.  
  17. "Jason A. Soloff" <jas251@psu.edu> wrote:
  18. >I am working on a monte carlo simulation program to model some problems 
  19. >in astronomy.  One thing I am running into, however, is the problem of 
  20. >the pseudo-random number tables.  Does anyone have an algorithm (or 
  21. >code) for a truly statistically random number generator?
  22.  
  23. This is not exactly a trivial question.  I'd suggest for a start getting a 
  24. copy of Donald Knuth's "The Art of Computer Programming"  volume 2:  
  25. "Seminumerical Algorithms," and reading chapter 3.  You'll learn a lot 
  26. about what it takes to make a (pseudo)-random number sequence "good" in 
  27. some sense, and how to test the result of any effort in that direction.  
  28. Check out his "algorithm M" in particular.  However, please note that the 
  29. chapter starts with a quote from John von Neumann:  "Anyone who considers 
  30. arithmetical methods of producing random number digits is, of course, in a 
  31. state of sin."
  32.  
  33. You should also give some thought as to how you are going to use the 
  34. numbers.  For example, if you use them in pairs, or n-tuples generally, 
  35. you'd want to check the distribution of the tuples.  (I can imagine your 
  36. project as generating simulated star fields, in which case you might be 
  37. generating position coordinate pairs for individual stars.)
  38.  
  39.  
  40.